package com.ctsi.offlinesupport.service;

import com.ctsi.commons.util.UtilValidate;
import com.ctsi.commons.util.id.UUIDGenerator;
import com.ctsi.framework.mybatis.support.MybatisGenericDao;
import com.ctsi.supportflow.app.entity.SmsMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SmsMessageService {

    private static final Logger logger = LoggerFactory.getLogger(SmsMessageService.class);

    @Autowired
    private MybatisGenericDao dao;

    public void insert(SmsMessage sms){
        if(UtilValidate.isEmpty(sms.getMlid()))
        {
            sms.setMlid(UUIDGenerator.getId());
        }
        logger.debug("insert {}",sms);
        dao.insert(sms);
    }

}
